namespace IrisGenerator.Dal {
    using System;
    using System.Collections.Generic;
    using System.Data.SqlClient;
    using System.Configuration;
    using System.Data;
    using System.Xml;
    
    
    public partial class Request : IDisposable {
        
        private DataAccess _dataAccess;
        
        public Request() {
            this._dataAccess = new DataAccess();
        }
        
        public virtual System.Data.DataSet Select_REQUEST_By_DB_ID(System.Nullable<System.Guid> DB_ID) {
            this._dataAccess.CreateProcedureCommand("sp_Select_REQUEST_By_DB_ID");
            this._dataAccess.AddParameter("DB_ID", DB_ID, ParameterDirection.Input);
            DataSet value = this._dataAccess.ExecuteDataSet();
            return value;
        }
        
        public virtual System.Data.DataSet Select_REQUEST_By_MET_ID(System.Nullable<System.Guid> MET_ID) {
            this._dataAccess.CreateProcedureCommand("sp_Select_REQUEST_By_MET_ID");
            this._dataAccess.AddParameter("MET_ID", MET_ID, ParameterDirection.Input);
            DataSet value = this._dataAccess.ExecuteDataSet();
            return value;
        }
        
        public virtual System.Data.DataSet Select_REQUEST_By_REQ_TYP_ID(System.Nullable<System.Guid> REQ_TYP_ID) {
            this._dataAccess.CreateProcedureCommand("sp_Select_REQUEST_By_REQ_TYP_ID");
            this._dataAccess.AddParameter("REQ_TYP_ID", REQ_TYP_ID, ParameterDirection.Input);
            DataSet value = this._dataAccess.ExecuteDataSet();
            return value;
        }
        
        public virtual System.Data.DataSet Select_REQUEST_By_TAB_ID(System.Nullable<System.Guid> TAB_ID) {
            this._dataAccess.CreateProcedureCommand("sp_Select_REQUESTs_By_TAB_ID");
            this._dataAccess.AddParameter("TAB_ID", TAB_ID, ParameterDirection.Input);
            DataSet value = this._dataAccess.ExecuteDataSet();
            return value;
        }
        
        public virtual System.Data.DataSet REQUEST_Select_All() {
            this._dataAccess.CreateProcedureCommand("sp_REQUEST_Select_All");
            DataSet value = this._dataAccess.ExecuteDataSet();
            return value;
        }
        
        public virtual System.Data.DataSet REQUEST_Select_One(System.Nullable<System.Guid> REQ_ID) {
            this._dataAccess.CreateProcedureCommand("sp_REQUEST_Select_One");
            this._dataAccess.AddParameter("REQ_ID", REQ_ID, ParameterDirection.Input);
            DataSet value = this._dataAccess.ExecuteDataSet();
            return value;
        }
        
        public virtual System.Nullable<System.Guid> REQUEST_Insert(System.Nullable<System.Guid> REQ_TYP_ID, System.Nullable<System.Guid> TAB_ID, System.Nullable<System.Guid> DB_ID, System.Nullable<System.Guid> MET_ID, string REQ_NAME, string REQ_FORMATED_NAME, string REQ_EXISTING_CODE, string REQ_GENERATED_CODE, System.Nullable<bool> REQ_OVERRIDE_EXISTING) {
            this._dataAccess.CreateProcedureCommand("sp_REQUEST_Insert");
            this._dataAccess.AddParameter("REQ_TYP_ID", REQ_TYP_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("TAB_ID", TAB_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("DB_ID", DB_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("MET_ID", MET_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("REQ_NAME", REQ_NAME, ParameterDirection.Input);
            this._dataAccess.AddParameter("REQ_FORMATED_NAME", REQ_FORMATED_NAME, ParameterDirection.Input);
            this._dataAccess.AddParameter("REQ_EXISTING_CODE", REQ_EXISTING_CODE, ParameterDirection.Input);
            this._dataAccess.AddParameter("REQ_GENERATED_CODE", REQ_GENERATED_CODE, ParameterDirection.Input);
            this._dataAccess.AddParameter("REQ_OVERRIDE_EXISTING", REQ_OVERRIDE_EXISTING, ParameterDirection.Input);
            Guid value = ((Guid)(this._dataAccess.ExecuteScalar()));
            return value;
        }
        
        public virtual System.Nullable<int> REQUEST_Delete(System.Nullable<System.Guid> REQ_ID) {
            this._dataAccess.CreateProcedureCommand("sp_REQUEST_Delete");
            this._dataAccess.AddParameter("REQ_ID", REQ_ID, ParameterDirection.Input);
            int value = this._dataAccess.ExecuteNonQuery();
            return value;
        }
        
        public virtual System.Nullable<int> REQUEST_Update(System.Nullable<System.Guid> REQ_ID, System.Nullable<System.Guid> REQ_TYP_ID, System.Nullable<System.Guid> TAB_ID, System.Nullable<System.Guid> DB_ID, System.Nullable<System.Guid> MET_ID, string REQ_NAME, string REQ_FORMATED_NAME, string REQ_EXISTING_CODE, string REQ_GENERATED_CODE, System.Nullable<bool> REQ_OVERRIDE_EXISTING) {
            this._dataAccess.CreateProcedureCommand("sp_REQUEST_Update");
            this._dataAccess.AddParameter("REQ_ID", REQ_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("REQ_TYP_ID", REQ_TYP_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("TAB_ID", TAB_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("DB_ID", DB_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("MET_ID", MET_ID, ParameterDirection.Input);
            this._dataAccess.AddParameter("REQ_NAME", REQ_NAME, ParameterDirection.Input);
            this._dataAccess.AddParameter("REQ_FORMATED_NAME", REQ_FORMATED_NAME, ParameterDirection.Input);
            this._dataAccess.AddParameter("REQ_EXISTING_CODE", REQ_EXISTING_CODE, ParameterDirection.Input);
            this._dataAccess.AddParameter("REQ_GENERATED_CODE", REQ_GENERATED_CODE, ParameterDirection.Input);
            this._dataAccess.AddParameter("REQ_OVERRIDE_EXISTING", REQ_OVERRIDE_EXISTING, ParameterDirection.Input);
            int value = this._dataAccess.ExecuteNonQuery();
            return value;
        }
        
        public virtual void Dispose() {
            if ((this._dataAccess != null)) {
                this._dataAccess.Dispose();
            }
        }
    }
}
